package thttp

import (
	"github.com/gin-gonic/gin"
	"gitee.com/man0sions/IdCreator/service/thttp/controller"
	"gitee.com/man0sions/IdCreator/service/thttp/middleware"
	//"github.com/gin-contrib/pprof"

)

func InitRouter(middlewares ...gin.HandlerFunc) *gin.Engine {

	//gin.SetMode(gin.ReleaseMode)
	router := gin.New()
	//pprof.Register(router) // 性能

	router.Use(middlewares...)
	router.Use(middleware.GinLog())
	v1 := router.Group("/v1")
	v1.Use(middleware.Recvoer())
	{
		api := &controller.Api{}
		v1.Any("/IdCreator", api.IdCreator)
		v1.GET("/test", api.Test)
	}
	return router
}
